package com.tjetc.mapper;

import com.tjetc.domain.FollowHospital;
import com.tjetc.domain.Hospital;
import com.tjetc.vo.HosClinFan;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface FollowHospitalMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(FollowHospital record);

    int insertSelective(FollowHospital record);

    FollowHospital selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(FollowHospital record);

    int updateByPrimaryKey(FollowHospital record);

    @Select("select * from follow_hospital where uid = #{uid} and hid = #{hid} ")
    FollowHospital selectByUidAndHid(@Param("uid") Integer uid,@Param("hid") Integer hid);

    @Select("select  count(*) from follow_hospital where uid = #{uid} ")
    Integer selectFollowCountByUid(Integer uid);

    List<Hospital> selNameAndIcon(Integer uid);

    @Delete("delete from follow_hospital where hid = #{hid} and uid = #{uid}")
    int deleteByHidAndUid(@Param("hid") Integer hid,@Param("uid") Integer uid);

    @Select("select h.* from follow_hospital fh,hospital h where fh.hid = h.id and fh.uid = #{uid}")
    List<Hospital> selByUid(Integer uid);

    HosClinFan getFansCount(Integer hid);
}